﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using IDAL.RF.SourceCategory;
using Model.RF.SourceCategory;

namespace DAL.RF.SourceCategory
{
    public class NFCheckItem : BaseRepository_DT<NFCheckItemInfo>, INFCheckItem
    {
        #region 静态字段部分
        private const string PARM_NFCHECKITEM_ID = "@ID";
        private const string PARM_NFCHECKITEM_TESTCHANNEL = "@TestChannel";
        private const string PARM_NFCHECKITEM_TESTITEM = "@TestItem";
        private const string PARM_NFCHECKITEM_SPEC = "@Spec";
        private const string PARM_NFCHECKITEM_RESULT = "@Result";
        private const string PARM_NFCHECKITEM_ISPASS = "@IsPass";
        #endregion

        #region 检索部分
        public IList<NFCheckItemInfo> LoadEntities()
        {
            return null;
        }

        public NFCheckItemInfo LoadEntity<T1>(T1 id)
        {
            return null;
        }

        public IList<NFCheckItemInfo> NFCheckItem_GetbyID(int id)
        {
            SqlParameter parm = GetParameter();
            parm.Value = id;
            return ExcuteSqlToGetEntities("NFCheckItem_selectbyID", parm);
        }
        #endregion

        #region 参数部分
        #endregion

        #region 重新基类部分
        public override NFCheckItemInfo GetEntityRecord(SqlDataReader rdr)
        {
            NFCheckItemInfo pro = new NFCheckItemInfo
            {
                ID = rdr.GetInt32(0),
                TestChannel = rdr.GetValue(1).ToString(),
                TestItem = rdr.GetValue(2).ToString(),
                Spec = rdr.GetDecimal(3),
                Result = rdr.GetDecimal(4),
                IsPass = rdr.GetBoolean(5)
            };
            return pro;
        }

        public override string GetInsertsp()
        {
            return "NFCheckItem_Insert";
        }

        public override string GetUpdatesp()
        {
            return base.GetUpdatesp();
        }

        public override string GetDeletesp()
        {
            return base.GetDeletesp();
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_NFCHECKITEM_ID, SqlDbType.Int, 4);
            return Parm;
        }

        public override SqlParameter[] GetParameters()
        {
            SqlParameter[] parms = null;
            parms = new SqlParameter[]
                {
					new SqlParameter(PARM_NFCHECKITEM_ID, SqlDbType.Int, 4),
					new SqlParameter(PARM_NFCHECKITEM_TESTCHANNEL, SqlDbType.NVarChar, 50),
                    new SqlParameter(PARM_NFCHECKITEM_TESTITEM, SqlDbType.NVarChar , 50),
					new SqlParameter(PARM_NFCHECKITEM_SPEC, SqlDbType.Decimal, 8),
                    new SqlParameter(PARM_NFCHECKITEM_RESULT,SqlDbType.Decimal,8),
                    new SqlParameter(PARM_NFCHECKITEM_ISPASS,SqlDbType.Bit,1)
                };
            return parms;
        }

        public override void SetParameters(NFCheckItemInfo tci, params SqlParameter[] Parms)
        {
            Parms[0].Value = tci.ID;
            Parms[1].Value = tci.TestChannel;
            Parms[2].Value = tci.TestItem;
            Parms[3].Value = tci.Spec;
            Parms[4].Value = tci.Result;
            Parms[5].Value = tci.IsPass;
        }
        #endregion
    }
}
